home *** CD-ROM | disk | FTP | other *** search
/ Business Assistant / Business Assistant.iso / checkb / pccheck / pc-check.pas < prev   
Pascal/Delphi Source File  |  1984-09-16  |  45KB  |  1,240 lines

  1. Program PC_Check;
  2.  
  3. {$C-}
  4.  
  5. {      PC-Check Copyright (c)  The Forbin Project and John Friel III
  6.  
  7.        PC-Check  is a checkbook and  savings  record  keeper  produced
  8.        by the  Forbin  Project.   Like some public domain software, we
  9.        are asking  for a  donation  for  the use  of this program.   A
  10.        donation of  only $5.00  is requested.   Those that  do  donate
  11.        will  receive  published announcements  for future enhancements
  12.        to  PC-Check  and other programs written by the Forbin Project.
  13.        PC-Check  may  be  transferred  to  other people  under two (2)
  14.        conditions;  that there is  NO CHARGE  for the copy(s) and that
  15.        the source program  not be modified in  any way, shape or form.
  16.        The user  may  modify  the source code  to suit his  or her own
  17.        personal tastes.    All rights reserved by the  Forbin Project.
  18.        Please keep an unmodified  copy  around just for  this purpose.
  19.        For  more  information  on  this  program  or   more   detailed
  20.        information  on interfacing  TURBO Pascal  with the  IBM PC  or
  21.        Compatibles, (this was developed on a Tava PC!) please write to
  22.        the Forbin Project at :
  23.  
  24.                           The Forbin Project
  25.                           John Friel III
  26.                           715 Walnut Street
  27.                           Cedar Falls, Iowa  50613
  28. }
  29.  
  30. Const
  31.   blink_yes        = true;
  32.   blink_no         = false;
  33.   yes_no           : set of char = ['Y','y','N','n'];
  34.   filechars        : set of char = ['A'..'Z','a'..'z','0'..'9',':',
  35.                                     '!','$','@','#','%','-','&'];
  36.  
  37. type
  38.   check_trans  = (cdeposit, cwithdrawl, cinterest,
  39.                   sdeposit, swithdrawl, sinterest);
  40.   check_type   = record
  41.                    post_date : string[8];
  42.                    check_no  : integer;
  43.                    to_who    : string[40];
  44.                    amount    : real;
  45.                    memo      : string[30];
  46.                    check_tran: check_trans;
  47.                    cleared   : boolean;
  48.                  end;
  49.   Names            = String[80];
  50.   Screen_Array     = Array [1..4000] of byte;
  51.   months           = 1..12;
  52.   days             = 1..31;
  53.   years            = 0..99;
  54.   xxxstr80         = string[80];
  55.   xxxstr8          = string[8];
  56.   xxxfile          = file;
  57.  
  58. Var
  59.   st1, st2, st3                 : string[2];
  60.   n_amount,temp_date            : string[8];
  61.   n_check_num                   : string[5];
  62.   new_amount, amount_h          : real;
  63.   t_cdc, t_cwc, t_cic,
  64.   t_sdc, t_swc, t_sic,
  65.   t_cdu, t_cwu, t_ciu,
  66.   t_sdu, t_swu, t_siu,
  67.   tcc, tcs, rbs, rbc            : real;
  68.   rc, check_num_h               : integer;
  69.   month                         : months;
  70.   day                           : days;
  71.   year                          : years;
  72.   trnfile                       : file of check_type;
  73.   one_trn                       : check_type;
  74.   x, i, y, q, e, w, check_num   : Integer;
  75.   to_whom, to_who_h             : string[40];
  76.   new_memo, memo_h              : string[30];
  77.   Ok, bool, done, edit_ok       : Boolean;
  78.   FileName                      : Names;
  79.   Real_Screen                   : Screen_Array absolute $B800:$0000;
  80.   Temp_Screen, temp_Screen2     : Screen_Array;
  81.   Ch, ch1,ch2                   : Char;
  82.   check_tran_h                  : check_trans;
  83.  
  84.  
  85. function readdate(x,y:integer):xxxstr8;
  86. {  reads a string from the terminal from screen at position xy  }
  87. {    the string will contain a Valid date in format 00/00/00  }
  88. Var
  89.    hold : array [1..6] of char;
  90.    location : integer;
  91.    inchar : char;
  92.  
  93. begin
  94.    location := 1;
  95.    gotoxy(x,y);
  96.    write('  /  /  ');
  97.    gotoxy(x,y);
  98.    while location<8 do
  99.       begin
  100.          read(kbd,inchar);
  101.          case location of
  102.             1:
  103.                begin
  104.                   gotoxy(x,y);
  105.                   if inchar in ['1','0',' '] then
  106.                      begin
  107.                         hold[1] := inchar;
  108.                         write(inchar);
  109.                         location := 2;
  110.                         gotoxy((x+1),y);
  111.                      end
  112.                   else
  113.                      begin
  114.                         write(chr(7));
  115.                      end;
  116.                end;
  117.             2:
  118.                begin
  119.                   gotoxy((x+1),y);
  120.                   if inchar in ['1'..'9','0'] then
  121.                      if hold[1]='1' then
  122.                         if inchar in ['1','2','0'] then
  123.                            begin
  124.                               hold[2] := inchar;
  125.                               write(inchar);
  126.                               location := 3;
  127.                            end
  128.                         else
  129.                            begin
  130.                               write(chr(7));
  131.                            end
  132.                      else
  133.                         begin
  134.                            write(inchar);
  135.                            hold[2] := inchar;
  136.                            location := 3;
  137.                         end
  138.                   else
  139.                      if ((inchar = chr(8)) or (inchar = chr(7))) then
  140.                         begin
  141.                            gotoxy(x,y);
  142.                            write(' ');
  143.                            location := 1;
  144.                            hold[1] := ' ';
  145.                            gotoxy(x,y);
  146.                         end
  147.                      else
  148.                         begin
  149.                            write(chr(7));
  150.                         end;
  151.                end;
  152.             3:
  153.                begin
  154.                   gotoxy((x+3),y);
  155.                   if inchar in ['1'..'3','0',' '] then
  156.                      begin
  157.                         hold[3] := inchar;
  158.                         write(inchar);
  159.                         location := 4;
  160.                         gotoxy((x+4),y);
  161.                      end
  162.                   else
  163.                      if ((inchar = chr(8)) or (inchar = chr(7))) then
  164.                         begin
  165.                            gotoxy((x+1),y);
  166.                            write(' ');
  167.                            location := 2;
  168.                            hold[2] := ' ';
  169.                            gotoxy((x+1),y);
  170.                         end
  171.                      else
  172.                         begin
  173.                            write(chr(7));
  174.                         end;
  175.                end;
  176.             4:
  177.                begin
  178.                   gotoxy((x+4),y);
  179.                   if inchar in ['1'..'9','0'] then
  180.                      begin
  181.                         hold[4] := inchar;
  182.                         write(inchar);
  183.                         location := 5;
  184.                         gotoxy((x+6),y);
  185.                      end
  186.                   else
  187.                      if ((inchar = chr(8)) or (inchar = chr(7))) then
  188.                         begin
  189.                            gotoxy((x+3),y);
  190.                            write(' ');
  191.                            location := 3;
  192.                            hold[3] := ' ';
  193.                            gotoxy((x+3),y);
  194.                         end
  195.                      else
  196.                         begin
  197.                            write(chr(7));
  198.                         end;
  199.                end;
  200.             5:
  201.                begin
  202.                   gotoxy((x+6),y);
  203.                   if inchar in ['1'..'9','0'] then
  204.                      begin
  205.                         hold[5] := inchar;
  206.                         write(inchar);
  207.                         location := 6;
  208.                         gotoxy((x+7),y);
  209.                      end
  210.                   else
  211.                      if ((inchar = chr(8)) or (inchar = chr(7))) then
  212.                         begin
  213.                            gotoxy((x+4),y);
  214.                            write(' ');
  215.                            location := 4;
  216.                            hold[4] := ' ';
  217.                            gotoxy((x+4),y);
  218.                         end
  219.                      else
  220.                         begin
  221.                            write(chr(